package com.sf.obserable;

import java.util.Observable;

/**
 * @author 埔枘
 * @date 2019/12/04
 * 被观察者
 **/
public class Iky extends Observable {
    //论坛
    private String name = "科研论坛";
    private static Iky iky;

    public static Iky getInstance(){
        if(iky == null){
            iky = new Iky();
        }
        return iky;
    }

    private Iky(){}

    public String getName() {
        return name;
    }

    /**
     *  发送消息
     */
    public void pushMessage(Question question){
        System.out.println(question.getName() + "在"+this.getName()+"提交了一个问题");
        setChanged();
        notifyObservers(question);
    }
}
